don't fire missing act() warnings for react-art #15975
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
react-art is a renderer that's usually embedded inside other renderer trees (like react-dom, etc) we fire a warning for being wrapped in the 'wrong' renderer's act. For an embedded usecase like react-art, this would mean you'd always see the warning. we could expose a new act() for react-art, but really we just want embedded renderers to not trigger the warning.
the first commit just fixes test infra for fixtures/dom (forking toWarnDev into itself)
the second commit is mostly what we're interested in 88fe0b4. For 'secondary' renderers like react-act, we don't want to fire missing act() warnings; the wrapping renderer will fire warnings anyway, and when it flushes, it flushes effects across renderers.
I could have used
isPrimaryRenderer
as the flag, but this is marked as false for react-test-renderer, and we do want the warning to fire for it. Hence a new flag.I'm open to a new name for
shouldWarnUnactedUpdates
.